package com.fce.boc.handler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;



//用来测试MQ连接是否正常
@Controller
public class RabbitMQAccumulatedController {
    Logger LOG = LoggerFactory.getLogger(RabbitMQAccumulatedController.class);
    @Autowired
    RabbitTemplate rabbitTemplate;

    @RequestMapping("/callAccumulated")
    public String callAccumulated(){
        LOG.info("msg:{}","开始向accumulated队列中发送一条消息！");
        // 参数：路由交换机，队列名 ，发送的消息
        rabbitTemplate.convertAndSend("directExchange","accumulatedRoutingKey","accumulatedMessage:这是一条accumulated消息！");
        return "success";
    }

}
